#if defined(CB_PRECOMP)
#include "sdk.h"
#endif
#ifndef CB_PRECOMP
	#include "manager.h"
	#include "sdk_events.h"
#endif
#include "globals.h"

#include "ThreadSearchViewManagerLayout.h"

ThreadSearchViewManagerLayout::~ThreadSearchViewManagerLayout() {
}

void ThreadSearchViewManagerLayout::AddViewToManager() {
	if ( m_IsManaged == false )
	{
	
		CodeBlocksDockEvent evt(cbEVT_ADD_DOCK_WINDOW);
		evt.name = _T("SnippetsSearch");
		evt.title = _("Snippets search");
		evt.pWindow = (wxWindow*)m_pThreadSearchView;
		evt.desiredSize.Set(800, 200);
		evt.floatingSize.Set(600, 200);
		evt.minimumSize.Set( 30, 40 );
		evt.stretch = true;
		evt.dockSide = CodeBlocksDockEvent::dsBottom;
		evt.shown = true;

	
	

		m_IsManaged = true;
		m_IsShown   = true;
	}
}

void ThreadSearchViewManagerLayout::RemoveViewFromManager() {
	if ( m_IsManaged == true )
	{
	
		CodeBlocksDockEvent evt(cbEVT_REMOVE_DOCK_WINDOW);
		evt.pWindow = (wxWindow*)m_pThreadSearchView;
		evt.shown = false;

	
	

		m_IsManaged = false;
		m_IsShown   = false;
	}
}


bool ThreadSearchViewManagerLayout::ShowView(bool show) {
	if ( (m_IsManaged == false) || (show == IsViewShown()) )
		return false;

	CodeBlocksDockEvent evt(show ? cbEVT_SHOW_DOCK_WINDOW : cbEVT_HIDE_DOCK_WINDOW);
	evt.pWindow = (wxWindow*)m_pThreadSearchView;
	evt.shown = show;


	m_IsShown = show;

	return true;
}


bool ThreadSearchViewManagerLayout::IsViewShown() {


	return m_IsShown && IsWindowReallyShown((wxWindow*)m_pThreadSearchView);
}

